/*****************************************************************************************
Arise Engine		ErrorsView.cpp

					E-mail:		arise_engine@mail.ru

created:			17.03.2007
last changes:		24.04.2007

ErrorsView.cpp : implementation of the ErrorsView class

Project is an MFC application, using the single-document model, split-window style.
Based on EffectEdit Direct3D Sample (c) Microsoft Corporation. All rights reserved.
*****************************************************************************************/
#include "stdafx.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// ErrorsView
IMPLEMENT_DYNCREATE(ErrorsView, CFormView)
BEGIN_MESSAGE_MAP(ErrorsView, CFormView)
    //{{AFX_MSG_MAP(CErrorsView)
    ON_WM_SIZE()
    ON_LBN_DBLCLK(IDC_ERRORS_LIST, OnDblclkList)
    ON_WM_CHAR()
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

HWND g_hwnd_errors_view;


ErrorsView::ErrorsView(): CFormView(ErrorsView::IDD)
{
}
ErrorsView::~ErrorsView()
{
}


BOOL ErrorsView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs

	return CFormView::PreCreateWindow(cs);
}

void ErrorsView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();

	// TODO: You may populate your TreeView with items by directly accessing
	//  its tree control through a call to GetTreeCtrl().
}


// ErrorsView diagnostics

#ifdef _DEBUG
void ErrorsView::AssertValid() const
{
	CFormView::AssertValid();
}

void ErrorsView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

CAriseEditorDoc* ErrorsView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CAriseEditorDoc)));
	return (CAriseEditorDoc*)m_pDocument;
}
#endif //_DEBUG


// ErrorsView message handlers


void ErrorsView::OnSize(UINT nType, int cx, int cy) 
{
    SetScrollSizes( MM_TEXT, CSize(cx, cy) );
    CFormView::OnSize(nType, cx, cy);
    
    CWnd* pList = GetDlgItem(IDC_ERRORS_LIST);
    if(pList) pList->SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOZORDER);
}


void ErrorsView::OnDblclkList() 
{
    //int iLine = m_listbox.GetCurSel();
    //if( iLine < 0 )
    //    return;
    //CString str;
    //m_listbox.GetText( iLine, str );

    //if( 1 == _stscanf( str, TEXT("(%d)"), &iLine ) )
    //{
    //    iLine--; // go from one-based (d3dx line numbers) to zero-based (CEdit line numbers)
    //    ((CEffectEditApp*)AfxGetApp())->SelectLine( iLine );
    //    PostMessage(WM_COMMAND, ID_PREV_PANE);
    //}
}


void ErrorsView::DoDataExchange(CDataExchange* pDX)
{
	g_hwnd_errors_view = GetSafeHwnd();

    CFormView::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CErrorsView)
	DDX_Control(pDX, IDC_ERRORS_LIST, g_editor.m_listbox_errors);
    //}}AFX_DATA_MAP
}


